<?php

declare(strict_types=1);

namespace SixShop\Wangdian\DTO\Trade;

/**
 * Order item DTO
 */
readonly class OrderItem
{
    public function __construct(
        public string $oid,
        public int $status,
        public int $refundStatus,
        public string $goodsId,
        public string $goodsName,
        public int $num,
        public float $price,
        public string $cid,
        public ?string $specId = null,
        public ?string $goodsNo = null,
        public ?string $specNo = null,
        public ?string $specName = null,
        public ?float $adjustAmount = null,
        public ?float $discount = null,
        public ?float $shareDiscount = null,
    ) {
    }

    public function toArray(): array
    {
        return [
            'oid' => $this->oid,
            'status' => $this->status,
            'refund_status' => $this->refundStatus,
            'goods_id' => $this->goodsId,
            'spec_id' => $this->specId,
            'goods_no' => $this->goodsNo,
            'spec_no' => $this->specNo,
            'goods_name' => $this->goodsName,
            'spec_name' => $this->specName,
            'num' => $this->num,
            'price' => $this->price,
            'adjust_amount' => $this->adjustAmount,
            'discount' => $this->discount,
            'share_discount' => $this->shareDiscount,
            'cid' => $this->cid,
        ];
    }
}